package com.wangnan.service;

import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.stereotype.Service;

@Service
public class HealthServer implements HealthIndicator {

    private Boolean status = true;

    public String isStatus() {
        return status.toString();
    }

    public void setStatus(boolean status) {
        this.status = status;
    }

    @Override
    public Health getHealth(boolean includeDetails) {
        return null;
    }

    @Override
    public Health health() {
       if (status){
           return new Health.Builder().up().build();
       }else {
           return new Health.Builder().down().build();
       }
    }
}
